﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="UserManagement.aspx.cs" Inherits="bts_webapp.UserManagement" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <telerik:RadCodeBlock ID="radCb" runat="server">
    <script language="javascript" type="text/javascript">
        function openWin(param) 
        {
            var oWnd = radopen(param, "RadWindow1");
            return true;
        }

        function clientClose() 
        {
            var bt = $get('<%=btRefreshGrid.ClientID %>');
            if (bt != null)
                bt.click();
        }
    </script>
    </telerik:RadCodeBlock>
    <div style="clear:both;"><h2>Quản lý thành viên</h2></div>
    <div>
        <asp:ScriptManager ID="scriptMan" runat="server" />
        <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>

        <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" Skin="Windows7" />

        <telerik:RadGrid Skin="Windows7"  runat="server" ID="RadGrid1" AutoGenerateColumns="false" OnItemCommand="RadGrid1_ItemCommand"
            AllowPaging="true" OnNeedDataSource="RadGrid1_NeedDataSource" OnUpdateCommand="RadGrid1_UpdateCommand"
            OnItemCreated="RadGrid1_ItemCreated" OnDeleteCommand="RadGrid1_DeleteCommand" AllowSorting="true"
            OnInsertCommand="RadGrid1_InsertCommand" OnItemDataBound="RadGrid1_ItemDataBound" AllowFilteringByColumn="True">
            <MasterTableView CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage" >
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="ColumnEdit" />

                    <telerik:GridBoundColumn DataField="User_Id" HeaderText="Username" AutoPostBackOnFilter="true" 
                        ForceExtractValue="Always" ConvertEmptyStringToNull="true" UniqueName="UserId" SortExpression="User_Id" />
                    <%--<telerik:GridBoundColumn DataField="User_Pass" HeaderText="Mật khẩu" UniqueName="Password" SortExpression="User_Pass" />--%>
                    <telerik:GridBoundColumn DataField="User_Full_Name" HeaderText="Họ và tên" UniqueName="UserFullname" SortExpression="User_Full_name" AutoPostBackOnFilter="true"  />
                    <telerik:GridBoundColumn DataField="User_Address" HeaderText="Địa chỉ" UniqueName="Address" SortExpression="User_Address" AutoPostBackOnFilter="true" />
                    <telerik:GridBoundColumn DataField="User_Phone" HeaderText="Số điện thoại" UniqueName="Phone" SortExpression="User_Phone" AutoPostBackOnFilter="true" />
                    <telerik:GridBoundColumn DataField="User_Email" HeaderText="Email" UniqueName="Email" SortExpression="User_Email" AutoPostBackOnFilter="true" />
                    <telerik:GridBoundColumn DataField="User_Role" HeaderText="Vai trò" UniqueName="Role" SortExpression="User_Role" AllowFiltering="false"/>
                    <telerik:GridBoundColumn DataField="User_Status" HeaderText="Trạng thái" UniqueName="Status" SortExpression="Status" AllowFiltering="false"/>

                    <telerik:GridButtonColumn UniqueName="ColumnDelete" ConfirmText="Bạn có muốn xóa người dùng này không?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" />
                </Columns>
                <EditFormSettings EditFormType="WebUserControl" UserControlName="~/UxUser.ascx">
                    <EditColumn ButtonType="ImageButton" />
                </EditFormSettings>
            </MasterTableView>

            <PagerStyle Mode="NextPrevNumericAndAdvanced" />
            
        </telerik:RadGrid>
        <asp:Button ID="btRefreshGrid" runat="server" OnClick="btRefreshGrid_Click" style="visibility:hidden;" />

    </div>
    <div>
         <telerik:RadWindowManager ID="RadWindowManager1" VisibleStatusbar="false"
                ReloadOnShow="true" runat="server" Skin="Windows7" EnableShadow="false">
                <Windows>
                    <telerik:RadWindow ID="RadWindow1" runat="server" ShowContentDuringLoad="false" Width="800px"
                Height="350px" Title="Detail information" Behaviors="Default" OnClientClose="clientClose"
                        NavigateUrl="~/UserPermission.aspx">
                    </telerik:RadWindow>
                </Windows>
            </telerik:RadWindowManager>
    </div>
</asp:Content>
